import React, { Component } from 'react'
import AddCount from './AddCount';
import SubCount from './SubCount';

export class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      count: 100
    }
  }
  changeCount (num) {
    this.setState({
      count: this.state.count + num
    })
  }
  render () {
    const { count } = this.state;
    return (
      <div>
        当前计数：{count}
        <AddCount addClick={(num) => this.changeCount(num)}></AddCount>
        <SubCount addClick={(num) => this.changeCount(num)}></SubCount>
      </div>
    )
  }
}

export default App